<!DOCTYPE html>
<html lang="en"
      xmlns:th="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8">

    <!-- 浏览器的预览设置 -->
    <meta name="viewport" content="width=device-width,initial-scale=1.0">

    <!--    样式-->
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/semantic-ui@2.4.2/dist/semantic.min.css"
          th:href="@{https://cdn.jsdelivr.net/npm/semantic-ui@2.4.2/dist/semantic.min.css}">
    <link rel="stylesheet" href="../../static/css/me.css"
          th:href="@{/css/me.css}">

    <!--    markdown-->
    <link rel="stylesheet" href="../../static/lib/editormd/css/editormd.min.css"
          th:href="@{/lib/editormd/css/editormd.min.css}">
    <!--    js-->
    <script src="https://cdn.jsdelivr.net/npm/jquery@3.2.1/dist/jquery.min.js"
            th:src="@{https://cdn.jsdelivr.net/npm/jquery@3.2.1/dist/jquery.min.js}"></script>
    <script src="https://cdn.jsdelivr.net/npm/semantic-ui@2.4.2/dist/semantic.min.js"
            th:src="@{https://cdn.jsdelivr.net/npm/semantic-ui@2.4.2/dist/semantic.min.js}"></script>
    <script src="../../static/lib/editormd/editormd.min.js"
            th:src="@{/lib/editormd/editormd.min.js}"></script>

    <title>博客添加</title>
</head>
<body>

<!--导航栏-->
<!-- 分隔-->
<nav class="ui inverted vertical segment m-padded-tb-mini m-shadow-small">
    <!--    容器-->
    <div class="ui container">
        <!--菜单（无分割线），stackable响应移动端,可堆叠-->
        <div class="ui inverted secondary stackable menu">
            <!--            标题元素-->
            <h2 class="ui blue header item">后台管理</h2>
            <!--            元素-->
            <a href="#"  th:href="@{/admin/blogs}" class="m-item item m-mobile-hide" ><i class="home icon"></i>博客</a>
<!--       active所在页面选项-->
            <a href="#"  th:href="@{/admin/types}" class="m-item item m-mobile-hide"><i class="idea icon"></i>分类</a>
            <a href="#" th:href="@{/admin/tags}" class="m-item item m-mobile-hide"><i class="tags icon"></i>标签</a>
<!--            m-item作为点击事件的一个标记-->
            <div class="right m-item m-mobile-hide menu">
                <div class="ui dropdown item">
                    <div class="text">
                        <img src="https://picsum.photos/id/200/400/400" alt=""  class="ui avatar image">
                        黄程福
                    </div>
<!--                    注销-->
                    <i class="dropdown icon"></i>
                    <div class="menu">
                        <a href="#" th:href="@{/admin/logout}" class="item">注销</a>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <a href="#" class="ui menu toggle black icon button m-right-top m-mobile-show ">
        <i class="sidebar icon"></i>
    </a>
</nav>

<div class="ui attached pointing menu">
    <div class="ui container">
        <div class="right aligned menu">
            <a href="#" th:href="@{/admin/blogs/add}" class="active teal item" >发布</a>
            <a href="#" th:href="@{/admin/blogs}" class="item">列表</a>
        </div>
    </div>
</div>

<!--中间内容-->
<div class="m-container-small m-padded-tb-large stackable">
    <div class="ui container">
        <form action="#" th:action="@{/admin/blogs/input}" method="post" class="ui form">
            <div class="required field">
                <br>
            </div>
            <div>
            <div class="field">
                <div class="ui left labeled input">
                    <label class="ui teal basic label">名称</label>
                    <input type="text" name="title" placeholder="标题名称">
                </div>
            </div>
                <div class="required field">
                    <textarea name="description" placeholder="博客描述..." maxlength="200"></textarea>
                </div>

                <div class="two fields">
                    <div class="required field">
                        <div class="ui left labeled action input">
                            <label class="ui compact teal basic label">分类</label>
                            <!--                类型-->
                            <div class="ui fluid selection dropdown">
                                <!--设置type的blog-->
                                <input type="hidden" name="type.id" th:value="${blog.getTypeId()}">
                                <!--                    编辑-->
                                <input type="hidden" name="typeId" th:text="${blog.getTypeId()}">
                                <i class="dropdown icon"></i>
                                <div class="default text">分类</div>
                                <div class="menu">
                                    <div th:each="type : ${types}"
                                         class="item" data-value="1"
                                         th:data-value="${type.id}"
                                         th:text="${type.name}">我的故事</div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <div class="ui error message"> </div>
            <div class="ui right aligned container">
                <!--                    window.history.go(-1)返回上一个页面，这里的button返回上一个页面-->
                <button type="button" class="ui button" onclick="window.history.go(-1)">返回</button>
<!--                判断提交的表单是否为为空-->
                <button class="ui teal button">提交</button>
            </div>
            <br>
            <br>
            <br>
            <br>
            <br>
        </form>
    </div>
</div>
<!--底部footer-->
<!--分割线-->
<footer class="ui inverted vertical segment m-padded-tb-massive">
    <!--    容器-->
    <div class="ui left aligned container">
        <!--        有分割线的分组-->
        <div class="ui inverted divided grid stackable ">
            <div class="eight wide column">
                <!--                标题-->
                <h4 class="ui inverted header">联系我</h4>
                <!--                列表-->
                <div class="ui link list">
                    <p class="m-text-thin m-text-spaced m-opacity-mi">@邮箱：605908340@qq.com</p>
                    <p class="m-text-thin m-text-spaced m-opacity-mi">@联系电话：15659132375</p>
                </div>
            </div>
            <div class="four wide column">
                <h4>作者寄语</h4>
                <p class="m-text-thin m-text-spaced m-opacity-mi">大家一起努力开始编程</p>
            </div>
            <div class="four wide column">
                <h4>对读者的祝福</h4>
                <p class="m-text-thin m-text-spaced m-opacity-mi">祝福大家第一年就月薪过万</p>
            </div>
        </div>
    </div>
</footer>

<div class="ui center aligned inverted divided vertical segment stackable">
    <p class="m-text-thin m-text-spaced m-opacity-mi">版权@(黄程福)605908340@qq.com</p>
</div>

<!--点击事件-->
<script>

    // 获取.menu.toggle点击时
    $('.menu.toggle').click(function (){
        $('.m-item').toggleClass('m-mobile-hide');
    });

    $('.ui.dropdown').dropdown();

    $('.ui.form').form({
        fields : {
            title : {
                identifier : 'title',
                rules : [{
                    type : 'empty',
                    prompt : '标题，请输入博客标题'
                }]
            }
        }
    });


    // markdown事件
    var contentEditor;

    $(function() {
        contentEditor = editormd("md-content", {
            width: "100%",
            height: 640,
            syncScrolling: "single",
            path: "../../static/lib/editormd/lib/"
        })
    })
</script>
</body>
</html>